﻿using System;
using System.Text;


namespace ACEPAPI.EPAPI
{
    /// <summary>
    /// 所有ESC/POS命令
    /// <see cref="https://reference.epson-biz.com/modules/ref_escpos/index.php"/>
    /// </summary>
    public static class Commands
    {
        /// <summary>
        /// 打印命令
        /// </summary>
        public static class Print
        {
            /// <summary>
            /// 打印和换行
            /// </summary>
            /// <remarks>
            /// ASC LF
            /// HEX 0A
            /// DEC 10
            /// - 打印打印缓冲区中的数据，并根据当前行距送入一行
            /// - 此命令将打印位置设置为行的开头
            /// - 每行进纸量基于使用行距命令(Esc 2或Esc 3)设置的值
            /// - 打印后，将打印位置移至可打印区域的左侧。此外，打印机处于“行开始”状态
            /// - 在页面模式下处理此命令时，仅打印位置移动，并且打印机不执行实际打印
            /// </remarks>
            public static byte[] LF => new byte[] { 0x0A };

            /// <summary>
            /// 打印并返回到标准模式（在页面模式下）
            /// </summary>
            /// <remarks>
            /// ASC FF
            /// HEX 0C
            /// DEC 12
            /// - 打印缓冲区中的打印数据并返回到标准模式
            /// - 缓冲区数据在打印后被删除
            /// - 打印机不执行裁纸
            /// - 此命令将打印位置设置为行的开头
            /// - 此命令仅在页面模式下启用
            /// (不支持TM-U220,TM-U230)
            /// </remarks>
            public static byte[] FF => new byte[] { 0x0C };

            /// <summary>
            /// 打印和回车
            /// </summary>
            /// <remarks>
            /// ASC CR
            /// HEX 0D
            /// DEC 13
            /// - 启用自动换行时，此命令的功能与LF相同，禁用自动换行时，将忽略此命令
            /// - 将打印开始位置设置为行的开头
            /// - 自动换行被忽略
            /// (不支持TM-P20,TM-P60,TM-P60II,TM-P80)
            /// </remarks>
            public static byte[] CR => new byte[] { 0x0D };

            /// <summary>
            /// 打印数据(页面模式)
            /// </summary>
            /// <remarks>
            /// ASC ESC FF
            /// HEX 1B  0C
            /// DEC 27  12
            /// - 在页面模式下，打印在打印缓冲区中的数据
            /// - 仅在页面模式下启用此命令。可以通过ESC L选择页面模式
            /// - 打印机以FF（页面模式下），ESC S和ESC @返回标准模式。当通过ESC @返回到标准模式时，所有设置都被取消
            /// - 打印后，打印机不会清除缓冲的数据，打印位置或其他命令设置的值
            /// - 当重复打印页面模式下的数据时使用此命令
            /// </remarks>
            public static byte[] PrintDataInPageMode() => new byte[] { 0x1B, 0x0C };

            /// <summary>
            /// 打印并进纸
            /// </summary>
            /// <param name="n">进纸单位0–255</param>
            /// <remarks>
            /// ASC ESC J   n
            /// HEX 1B  4A  n
            /// DEC 27  74  n
            /// - 在打印缓冲区中打印数据并进纸[n×（垂直或水平运动单位）]
            /// - 最大进纸量取决于打印机型号。如果超过最大数量，则执行最大进纸量
            /// - 打印后，将打印位置移至可打印区域的左侧。此外，打印机处于“行开始”状态
            /// - 在页面模式下处理此命令时，仅打印位置会移动；打印机不执行实际打印
            /// - 此命令用于临时输入特定长度，而无需更改其他命令设置的行距
            /// - TM-U220:垂直运动单位为0.176毫米{1/144英寸}。该值等于1/2点间距。该命令不使用水平运动单元，因为打印机不支持页面模式。 最大进纸量为1016毫米{40英寸}。
            /// </remarks>
            public static byte[] PrintAndFeed(int n) => new byte[] { 0x1B, 0x4A, (byte)n };

            /// <summary>
            /// 打印并反向进纸
            /// </summary>
            ///<param name="n">反向进纸单位</param>
            /// <remarks>
            /// ASC ESC K   n
            /// HEX 1B  4B  n
            /// DEC 27  75  n
            /// - 打印打印缓冲区中的数据，并以反方向送入纸张n×(垂直或水平运动单位)
            /// - TM-U220: n = 0 – 48
            /// - TM-U220: 由于打印机机制的限制，打印机在反向送纸后最多执行2.12毫米（12/144英寸）的正向送纸
            /// - TM-U220: 当n≤12时，正向进纸量与反向进纸量相同，因此实际进纸长度为0
            /// - TM-U220: 当n> 12时，向前进给量为12/144英寸。因此，最大反向进纸长度在TM-U220A，TM-U220B中为6.35毫米{（48-12）/ 144英寸}，在TM-U220D中为3.35毫米{（31-12）/ 144英寸}
            /// - TM-U220: 此命令不得连续执行两次以上
            /// </remarks>
            public static byte[] PrintAndReverseFeed(int n) => new byte[] { 0x1B, 0x4B, (byte)n };

            /// <summary>
            /// 打印并进纸n行
            /// </summary>
            /// <param name="n">进纸行数0-255</param>
            /// <remarks>
            /// ASC ESC d   n
            /// HEX 1B  64  n
            /// DEC 27  100 n
            /// - 打印打印缓冲区中的数据并送入n行
            /// - 每行的进纸量基于使用行距命令（ESC 2或ESC 3）设置的值
            /// - 最大进纸量取决于打印机型号。如果超出最大数量，则执行最大进纸量
            /// - 此命令用于临时馈送特定的行，而不更改其他命令设置的行距
            /// - TM-U220:最大进纸量为1016毫米{40英寸}
            /// </remarks>
            public static byte[] PrintAndFeedLines(int n) => new byte[] { 0x1B, 0x64, (byte)n };

            /// <summary>
            /// 打印并反向进纸n行
            /// </summary>
            /// <param name="n" value="0-2">进纸行数</param>
            /// <remarks>
            /// ASC ESC e   n
            /// HEX 1B  65  n
            /// DEC 27  101 n
            /// - TM-U220:n=0-2
            /// - 打印打印缓冲区中的数据，并反方向送入n行
            /// - TM-U220其它事项请参考官方文档说明
            /// <see cref="https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=18"/>
            /// </remarks>
            public static byte[] PrintAndReverseFeedLines(int n) => new byte[] { 0x1B, 0x65, (byte)n };
        }

        /// <summary>
        /// 行距命令
        /// </summary>
        public static class LineSpaceing
        {
            /// <summary>
            /// 选择行间距(参数要测试)
            /// </summary>
            /// <remarks>
            /// ASC ESC 2 / ESC 3   n
            /// HEX 1B  32/ 1B  33  n
            /// DEC 27  50/ 27  51  n
            /// n=0-255
            /// n=0.141mm或25.4/180
            /// </remarks>
            public static byte[] SelectLineSpacing(LineSpacingType lineSpacing)
            {
                return lineSpacing == LineSpacingType.Default ? new byte[] { 0x1B, (byte)lineSpacing } : new byte[] { 0x1B, 0x33, (byte)lineSpacing };
            }

            /// <summary>
            /// 选择行间距(参数要测试)
            /// </summary>
            /// <param name="n">单位(0-255)</param>
            public static byte[] SelectLineSpacing(int n) => new byte[] { 0x1B, 0x33, (byte)n };
        }

        /// <summary>
        /// 字符命令
        /// </summary>
        public static class Character
        {
            /// <summary>
            /// 在页面模式下取消打印数据
            /// </summary>
            /// <remarks>
            /// ASC CAN
            /// HEX 18
            /// - 此命令仅在页面模式下启用
            /// - 在页面模式下，删除当前可打印区域中的所有打印数据
            /// - 如果先前指定的可打印区域中存在的数据也存在于当前指定的可打印区域中，则将其删除
            /// </remarks>
            public static byte[] CAN => new byte[] { 0x18 };

            /// <summary>
            /// 设置右侧字符间距
            /// </summary>
            /// <param name="n">0 – 255</param>
            /// <remarks>
            /// ASCII   ESC SP  n
            /// HEX     1B  20  n
            /// n = 0 – 255
            /// </remarks>
            public static byte[] SetRightSideCharacterSpacing(int n) => new byte[] { 0x1B, 0x20, (byte)n };

            /// <summary>
            /// 选择打印模式
            /// n = 0 – 255
            /// ESC !   n
            /// 1B  21 	n
            /// </summary>
            /// <param name="printMode">打印模式</param>
            public static byte[] SetPrintMode(PrintMode printMode) => new byte[] { 0x1B, 0x21, (byte)printMode };

            /// <summary>
            /// 开启/关闭下划线模式
            /// ESC -   n
            /// 1B  2D  n
            /// </summary>
            public static byte[] SetUnderlineMode(UnderlineMode underlineMode) => new byte[] { 0x1B, 0x2D, (byte)underlineMode };

            /// <summary>
            /// 打开/关闭强调模式
            /// ESC E   n
            /// 1B  45  n
            /// </summary>
            /// <param name="switch">开关</param>
            /// <returns></returns>
            public static byte[] SetEmphasizedMode(Switch @switch) => new byte[] { 0x1B, 0x45, (byte)@switch };

            /// <summary>
            /// 选择/取消双重打印模式
            /// ESC G   n
            /// 1B  47  n
            /// 0=关闭
            /// 1=开启
            /// </summary>
            /// <param name="switch">开关</param>
            public static byte[] SetDoubleStrike(Switch @switch) => new byte[] { 0x1B, 0x47, (byte)@switch };

            /// <summary>
            /// 选择字符字体
            /// ESC M   n
            /// 1B  4D  n
            /// </summary>
            /// <param name="font">字体</param>
            public static byte[] SetCharacterFont(Font font) => new byte[] { 0x1B, 0x4D, (byte)font };

            /// <summary>
            /// 选择一个国际字符集
            /// ESC R   n
            /// 1B  52  n
            /// </summary>
            /// <param name="charSet">国际字符集</param>
            public static byte[] SetInternationalCharacterSet(CharSet charSet) => new byte[] { 0x1B, 0x52, (byte)charSet };

            /// <summary>
            /// 开启/关闭顺时针旋转90°模式
            /// ESC V   n
            /// 1B  56  n
            /// </summary>
            /// <param name="clockwiseDirection">字符旋转90°模式</param>
            public static byte[] Turn90Degrees(ClockwiseDirection clockwiseDirection) => new byte[] { 0x1B, 0x56, (byte)clockwiseDirection };

            /// <summary>
            /// 选择打印颜色
            /// ESC r   n
            /// 1B  72  n
            /// </summary>
            /// <param name="printColor">打印颜色</param>
            /// <returns></returns>
            public static byte[] SetPrintColor(PrintColor printColor) => new byte[] { 0x1B, 0x72, (byte)printColor };

            /// <summary>
            /// 选择字符码表
            /// ESC t   n
            /// 1B  74  n
            /// </summary>
            /// <param name="codeTable">字符码表</param>
            public static byte[] SetCodeTable(CodeTable codeTable) => new byte[] { 0x1B, 0x74, (byte)codeTable };

            /// <summary>
            /// 打开/关闭颠倒(上下)打印模式
            /// ESC {   n
            /// 1B  7B  n
            /// </summary>
            /// <param name="switch">开关</param>
            public static byte[] SetUpsideDown(Switch @switch) => new byte[] { 0x1B, 0x7B, (byte)@switch };

            /// <summary>
            /// 选择字符大小
            /// GS  !   n
            /// 1D  21  n
            /// </summary>
            /// <param name="charSizeWidth">字符宽度</param>
            /// <param name="charSizeHeight">字符高度</param>
            public static byte[] SetCharSize(CharSizeWidth charSizeWidth, CharSizeHeight charSizeHeight)
            {
                var charSize = (byte)charSizeWidth | (byte)charSizeHeight;
                return new byte[] { 0x1D, 0x21, (byte)charSize };
            }

            /// <summary>
            /// 选择字符宽度大小
            /// GS ! n
            /// </summary>
            /// <param name="charSize">字符高度</param>
            public static byte[] SelectCharSizeHeight(CharSizeHeight charSize) => new byte[] { 0x1D, 0x21, (byte)charSize };

            /// <summary>
            /// 选择字符高度大小
            /// GS ! n
            /// </summary>
            /// <param name="charSize">字符宽度</param>
            public static byte[] SelectCharSizeWidth(CharSizeWidth charSize) => new byte[] { 0x1D, 0x21, (byte)charSize };

            /// <summary>
            /// 打开/关闭白色/黑色反向打印模式
            /// GS  B   n
            /// 1D  42  n
            /// </summary>
            /// <param name="switch">开关</param>
            /// <returns></returns>
            public static byte[] WhiteBlackReversePrintMode(Switch @switch) => new byte[] { 0x1D, 0x42, (byte)@switch };

            /// <summary>
            /// 开启/关闭平滑模式
            /// GS  b   n
            /// 1D  62  n
            /// </summary>
            /// <param name="switch">开关</param>
            /// <remarks>
            /// (不支持TM-U220,TM-U230)
            /// </remarks>
            public static byte[] TurnSmoothingMode(Switch @switch) => new byte[] { 0x1D, 0x62, (byte)@switch };

            //字符效果
            /// <summary>
            /// 选择字符效果
            /// GS  (   N   pL  pH  fn  [parameters]
            /// 1D  28  4E
            /// </summary>
            public static byte[] SelectCharacterEffects() => throw new NotImplementedException();

            /// <summary>
            /// 选择字符颜色
            /// GS  (   N   pL  pH  fn  m
            /// 1D  28  4E  02  00  30  m
            /// </summary>
            /// <param name="color">颜色</param>
            public static byte[] SelectCharacterColor(Color @color) => new byte[] { 0x1D, 0x28, 0x4E, 0x02, 0x00, 0x30, (byte)@color };

            /// <summary>
            /// 选择背景色
            /// GS  (   N   pL  pH  fn  m
            /// 1D  28  4E  02  00  31  m
            /// </summary>
            /// <param name="color">颜色</param>
            public static byte[] SelectBackgroundColor(Color @color) => new byte[] { 0x1D, 0x28, 0x4E, 0x02, 0x00, 0x31, (byte)@color };
            /// <summary>
            /// 打开/关闭阴影模式
            /// GS  (   N   pL  pH  fn  m   a
            /// 1D  28  4E  03  00  32  m   a
            /// </summary>
            /// <param name="switch">开关</param>
            /// <param name="color">颜色</param>
            /// <returns></returns>
            public static byte[] SelectShadingMode(Switch @switch, Color color) => new byte[] { 0x1D, 0x28, 0x4E, 0x03, 0x00, 0x32, (byte)@switch, (byte)color };

            //用户定义字符
            /// <summary>
            /// 选择/取消用户定义的字符集
            /// ESC %   n
            /// 1B  25  n
            /// </summary>
            /// <param name="switch">开关</param>
            /// <remarks>
            /// (不支持TM-P60,TM-P60II)
            /// </remarks>
            public static byte[] SelectUserDefinedCharacterSet(Switch @switch) => new byte[] { 0x1B, 0x25, (byte)@switch };

            /// <summary>
            /// 定义用户定义的字符
            /// ESC &   y   c1  c2  [x1 d1  ... d(y×x1)]  ... [xk   d1  ... d(y × xk)]
            /// 1B  26  y   c1  c2  []  ... []
            /// </summary>
            /// <remarks>
            /// 32 ≤ c1 ≤ c2 ≤ 126
            /// d = 0 – 255
            /// k = c2 - c1 + 1
            /// </remarks>
            public static byte[] DefineUserDefinedCharacters() => throw new NotImplementedException();

            /// <summary>
            /// 取消用户定义的字符
            /// ESC ?   n
            /// 1B  3F  n
            /// </summary>
            /// <param name="n">n = 32 – 126</param>
            public static byte[] CancelUserDefinedCharacters(int n) => new byte[] { 0x1B, 0x3F, (byte)n };

            //代码转换方法 
            /// <summary>
            /// 选择代码转换方式
            /// FS  (   C   pL  pH  fn  [parameters]
            /// 1C  28  43  pL  pH  fn  [parameters]
            /// </summary>
            /// <returns></returns>
            public static byte[] SelectCodeConversionMethod() => throw new NotImplementedException();

            /// <summary>
            /// 选择字符编码系统
            /// FS  (   C   pL  pH  fn  m
            /// 1C  28  43  02  00  30  m
            /// m = 1-2,49-50
            /// </summary>
            /// <param name="encode">编码系统</param>
            public static byte[] SelectCharacterEncodeSystem(EncodeSystem @encode) => new byte[] { 0x1C, 0x28, 0x43, 0x02, 0x00, 0x30, (byte)@encode };

            /// <summary>
            /// 选择字体优先级
            /// FS  (   C   pL  pH  fn  m   a
            /// 1C  28  43  02  00  3C  m   a
            /// 
            /// </summary>
            /// <returns></returns>
            public static byte[] SetFontPriority(Priority priority, FontType fontType) => new byte[] { 0x1C, 0x28, 0x43, 0x02, 0x00, 0x3C, (byte)priority, (byte)fontType };

        }

        /// <summary>
        /// 打印纸命令
        /// </summary>
        public static class PrintingPaper
        {
            //标签和黑标控制
            /// <summary>
            /// 选择标签和黑标控制功能
            /// FS  (   L   pL  pH  fn  [parameters]
            /// 1C  28  4C  pL  pH  fn  [parameters]
            /// </summary>
            public static byte[] SelectLabelAndBlackMarkControl() => throw new NotImplementedException();
            //
            /// <summary>
            /// 纸张布局设置
            /// FS  (   L<fn=33>
            /// </summary>
            public static byte[] PaperLayoutSetting() => throw new NotImplementedException();

            /// <summary>
            /// 纸张布局信息传输
            /// FS  (   L<fn=34>
            /// </summary>
            public static byte[] PaperLayoutInformationTransmission() => throw new NotImplementedException();

            /// <summary>
            /// 传送定位信息
            /// FS  (   L<fn=48>
            /// </summary>
            public static byte[] TransmitThePositioningInformation() => throw new NotImplementedException();

            /// <summary>
            /// 将纸张送入标签剥离位置
            /// FS  (   L<fn=65>
            /// </summary>
            public static byte[] FeedPaperToTheLabelPeelingPosition() => throw new NotImplementedException();

            /// <summary>
            /// 将纸张送入裁切位置
            /// FS  (   L<fn=66>
            /// </summary>
            public static byte[] FeedPaperToTheCuttingPosition() => throw new NotImplementedException();

            /// <summary>
            /// 将纸张送入打印开始位置
            /// FS  (   L<fn=67>
            /// </summary>
            public static byte[] FeedPaperToThePrintStartingPosition() => throw new NotImplementedException();

            /// <summary>
            /// 纸张布局错误特殊边距设置
            /// FS  (   L<fn=80>
            /// </summary>
            public static byte[] PaperLayoutErrorSpecialMarginSetting() => throw new NotImplementedException();
        }

        /// <summary>
        /// 打印位置命令
        /// </summary>
        public static class PrintPosition
        {
            /// <summary>
            /// 水平制表符
            /// 将打印位置移动到下一个制表符位置
            /// </summary>
            /// <remarks>
            /// - 除非已设置下一个制表符位置，否则将忽略此命令
            /// - 如果下一个水平制表符位置超出了打印区域，则打印机将打印位置设置为[打印区域宽度+ 1]
            /// - 如果在打印位置为[打印区域宽度+1]时收到此命令，则打印机将执行当前行的打印缓冲区已满打印，
            /// 并从下一行的开头开始执行水平制表符处理
            /// - 纸卷的水平制表符位置的默认设置是每8个字符（第9、17、25，…列）使用字体A（12 x 24）
            /// </remarks>
            public static byte[] HorizontalTab => new byte[] { 0x09 };

            /// <summary>
            /// 水平制表符
            /// HorizontalTab 简写
            /// </summary>
            public static byte[] HT => HorizontalTab;

            /// <summary>
            /// 设置绝对打印位置
            /// ESC $   nL  nH
            /// 1B  24  nL  nH
            /// (nL + nH × 256) = 0 – 65535
            /// </summary>
            public static byte[] SetAbsolutePrintPosition(int nL, int nH) => new byte[] { 0x1B, 0x24, (byte)nL, (byte)nH };

            /// <summary>
            /// 设置水平制表符位置
            /// ESC D   n1 ... nk   NUL
            /// 1B  44  n1 ... nk   00
            /// </summary>
            /// <remarks>
            /// n = 1 – 255
            /// k = 0 – 32
            /// n = 8、16、24、32，...，232、240、248（默认字体集每八个字符）
            /// </remarks>
            public static byte[] SetHorizontalTabPositions() => throw new NotImplementedException();

            /// <summary>
            /// 在页面模式下选择打印方向
            /// </summary>
            /// <remarks>
            /// ASCII   ESC T   n
            /// HEX     1B  54  n
            /// (不支持TM-U220,TM-U230)
            /// </remarks>
            public static byte[] SelectPrintDirection(Direction direction) => new byte[] { 0x1B, 0x54, (byte)direction };

            /// <summary>
            /// 在页面模式下设置打印区域
            /// ESC W   xL	xH	yL	yH	dxL	dxH	dyL	dyH
            /// 1B  57  xL	xH	yL	yH	dxL	dxH	dyL	dyH
            /// </summary>
            public static byte[] SetPrintAreaInPageMode() => throw new NotImplementedException();

            /// <summary>
            /// 设置相对打印位置
            /// ESC \   nL  nH
            /// 1B  5C  nL  nH
            /// </summary>
            public static byte[] SetRelativePrintPosition() => throw new NotImplementedException();

            /// <summary>
            /// 选择对齐方式
            /// ESC a   n
            /// 1B  61  n
            /// </summary>
            public static byte[] SelectJustification(Justification justification) => new byte[] { 0x1B, 0x61, (byte)justification };

            /// <summary>
            /// 在页面模式下设置绝对垂直打印位置
            /// GS  $   nL  nH
            /// 1D  24  nL  nH
            /// </summary>
            public static byte[] SetAbsoluteVerticalPrintPositionInPageMode() => throw new NotImplementedException();

            /// <summary>
            /// 设置左边距
            /// GS  L   nL  nH
            /// 1D  4C  nL  nH
            /// </summary>
            public static byte[] SetLeftMargin() => throw new NotImplementedException();

            /// <summary>
            /// 将打印位置设置为打印行的开头
            /// GS  T   n
            /// 1D  54  n
            /// </summary>
            public static byte[] SetPrintPositionToTheBeginningOfPrintLine() => throw new NotImplementedException();

            /// <summary>
            /// 设定打印区域宽度
            /// GS  W   nL  nH
            /// 1D  57  nL  nH
            /// </summary>
            public static byte[] SetPrintAreaWidth() => throw new NotImplementedException();

            /// <summary>
            /// 在页面模式下设置相对垂直打印位置
            /// GS  \   nL  nH
            /// 1D  5C  nL  nH
            /// </summary>
            public static byte[] SetRelativeVerticalPrintPositionInPageMode() => throw new NotImplementedException();

        }

        /// <summary>
        /// 纸张传感器命令
        /// </summary>
        public static class PaperSensor
        {
            /// <summary>
            /// 选择纸张传感器以输出纸张用尽信号
            /// </summary>
            /// <remarks>
            /// ASCII   ESC c   3   n
            /// HEX     1B  63  33  n
            /// </remarks>
            public static byte[] SelectPaperSensorToOutputPaperEndSignals() => throw new NotImplementedException();

            /// <summary>
            /// 选择纸张传感器以停止打印
            /// </summary>
            /// <remarks>
            /// ASCII   ESC c   4   n
            /// HEX     1B  63  34  n
            /// </remarks>
            public static byte[] SelectPaperSensorToStopPrinting() => throw new NotImplementedException();
        }

        /// <summary>
        /// 机械控制命令
        /// </summary>
        public static class MechanismControl
        {
            /// <summary>
            /// 返回初始
            /// </summary>
            /// <remarks>
            /// ASC ESC <
            /// HEX 1B  3C
            /// DEC 27  60
            /// - 将打印头移动到待机位置
            /// </remarks>
            public static byte[] ReturnHome() => new byte[] { 0x1B, 0x3C };

            /// <summary>
            /// 打开/关闭单向打印模式
            /// </summary>
            /// <remarks>
            /// ASC ESC U   n
            /// HEX 1B  55  n
            /// DEC 27  85  n
            /// - 在打印双倍高度的字符或图形或位图或二维代码时，可以打开单向打印模式，以确保打印图案的顶部和底部对齐
            /// </remarks>
            public static byte[] TurnUnidirectionalPrintMode(Switch @switch) => new byte[] { 0x1B, 0x55, (byte)@switch };

            /// <summary>
            /// 部分切割（在边上一留部分不切割）
            /// </summary>
            /// <remarks>
            /// ASC ESC i
            /// HEX 1B  69
            /// DEC 27  105
            /// - 对卷纸进行部分切割
            /// - 切割形状取决于安装的自动切割机的规格
            /// - TM-U220:打印机出厂时，该设置为部分裁切（仅剩一点）
            /// - TM-U220:由于TM-U220D没有配备自动切纸器，因此该命令将被TM-U220D忽略
            /// - TM-U220:在TM-U220A和TM-U220B中，从打印头到自动切纸器的距离约为27毫米（1.06英寸）
            /// </remarks>
            [Obsolete("建议使用GS V切纸")]
            public static byte[] PaperCut1() => new byte[] { 0x1B, 0x69 };

            /// <summary>
            /// 部分切割（留三个部分不切割）
            /// 对卷纸进行部分切割
            /// (建议使用GS V裁纸)
            /// </summary>
            /// <remarks>
            /// ASC ESC m
            /// HEX 1B  6D
            /// DEC 27  109
            /// - 对卷纸进行部分切割
            /// - 切割形状取决于安装的自动切割机的规格
            /// </remarks>
            [Obsolete("建议使用GS V切纸")]
            public static byte[] PaperCut3() => new byte[] { 0x1B, 0x6D };

            /// <summary>
            /// 选择裁切模式并裁切纸张
            /// </summary>
            /// <param name="cutMode">模式选择</param>
            /// <param name="n">参数</param>
            /// <remarks>
            /// <Function A>全切
            /// ASC GS  V   m
            /// HEX 1D  56  m
            /// DEC 29  86  m
            /// <Function B>送纸并切纸
            /// <Function C>设置切纸位置
            /// <Function D>进纸并裁切纸张，然后进纸至打印开始位置
            /// ASC GS  V   m   n
            /// HEX 1D  56  m   n
            /// DEC 29  86  m   n
            /// </remarks>
            public static byte[] PaperCut(PaperCutMode cutMode, int n = 0)
            {
                switch (cutMode)
                {
                    case PaperCutMode.FullCut:
                        return new byte[] { 0x1D, 0x56, (byte)cutMode };
                    case PaperCutMode.PartialCut:
                        return new byte[] { 0x1D, 0x56, (byte)cutMode };
                    default:
                        return new byte[] { 0x1D, 0x56, (byte)cutMode, (byte)n };
                }
            }
        }

        /// <summary>
        /// 位图命令
        /// </summary>
        public static class BitImage
        {
            //GS ( L / GS 8 L
            //GS D

            //位图
            /// <summary>
            /// 选择位图模式
            /// </summary>
            /// <remarks>
            /// ASCII   ESC *   m   nL  nH  d1 ... dk
            /// HEX     1B  2A  m   nL  nH  d1 ... dk
            /// </remarks>
            public static byte[] SelectBitImageMode() => throw new NotImplementedException();

            //FS p
            //FS q
            //GS*
            //GS /
            //GS Q 0
            //GS v 0

            //图形
            //GS(L<fn=49>
            //GS (L<fn=50>
            //GS (L / GS 8 L<fn=112>
            //GS (L / GS 8 L<fn=113>

            //NV图形
            //GS(L<fn=48>
            //GS (L<fn=51>
            //GS (L<fn=64>
            //GS (L<fn=65>
            //GS (L<fn=66>
            //GS (L / GS 8 L<fn=67>
            //GS (L / GS 8 L<fn=68>
            //GS (L<fn=69>
            //GS D <fn= 67 >

            //下载图形
            //GS(L<fn=52>
            //GS (L<fn=80>
            //GS (L<fn=81>
            //GS (L<fn=82>
            //GS (L / GS 8 L<fn=83>
            //GS (L / GS 8 L<fn=84>
            //GS (L<fn=85>
            //GS D <fn= 83 >
        }

        /// <summary>
        /// 面板按钮命令
        /// </summary>
        public static class PanelButton
        {
            /// <summary>
            /// 启用/禁用面板按钮
            /// </summary>
            /// <remarks>
            /// ASCII   ESC c   5   n
            /// HEX     1B  63  35  n
            /// </remarks>
            public static byte[] SelectPanelButtons(Switch @switch) => new byte[] { 0x1B, 0x63, 0x35, (byte)@switch };
        }

        /// <summary>
        /// 状态命令
        /// </summary>
        public static class Status
        {
            /// <summary>
            /// 传输实时状态
            /// </summary>
            /// <remarks>
            /// ASC DLE EOT n   [a]
            /// HEX 10  04  n   [a]
            /// TM-U220:n = 1 – 4
            /// </remarks>
            public static byte[] TransmitRealtimeStatus(RealtimeStatus realtimeStatus) => new byte[] { 0x10, 0x04, (byte)realtimeStatus };

            /// <summary>
            /// 传输外围设备状态
            /// </summary>
            /// <remarks>
            /// ASC ESC u   n
            /// HEX 1B  75  n
            /// n = 0, 48
            /// </remarks>
            [Obsolete("建议使用GS r检查状态，并使用GS r传输外围设备状态")]
            public static byte[] TransmitPeripheralDeviceStatus() => new byte[] { 0x1B, 0x75, 0 };

            /// <summary>
            /// 传输纸张传感器状态
            /// </summary>
            /// <remarks>
            /// ASC ESC v
            /// HEX 1B  76
            /// </remarks>
            [Obsolete("建议使用GS r检查状态，并使用GS r传输纸张传感器状态")]
            public static byte[] TransmitPaperSensorStatus() => new byte[] { 0x1B, 0x76 };

            /// <summary>
            /// 启用/禁用自动状态返回(ASB)的扩展状态
            /// </summary>
            /// <remarks>
            /// ASC FS  (   e   pL  pH  m   n
            /// HEX 1C  28  65  pL  pH  m   n
            /// (pL + pH × 256) = 2
            /// m = 51
            /// n = 0 – 255
            /// 启用或禁用扩展的ASB（自动状态返回）并指定要包括的状态项，使用n bit 如下所示
            /// 0-2bit  保留                     0   00  0
            /// 3bit    禁用命令执行离线状态      0   00  0
            /// 3bit    启用命令执行离线状态      1   08  8
            /// 4-7bit  保留                     0   00  0
            /// <see cref="https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=121"/>
            /// </remarks>
            public static byte[] SelectAutoStatusBackExt() => throw new NotImplementedException();

            /// <summary>
            /// 启用/禁用自动状态返回
            /// </summary>
            /// <param name="asbTypes">ASB状态(可按位相加)</param>
            /// <remarks>
            /// ASC GS  a   n
            /// HEX 1D  61  n
            /// <see cref="https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=122"/>
            /// </remarks>
            public static byte[] SelectAutoStatusBack(ASBType asbTypes) => new byte[] { 0x1D, 0x61, (byte)asbTypes };

            /// <summary>
            /// 启用/禁用墨水的自动状态返回(ASB)
            /// </summary>
            /// <remarks>
            /// ASC GS  j   n
            /// HEX 1D  6A  n
            /// n值：
            /// 0bit:0   禁用墨水机制的在线/离线状态
            /// 0bit:1   启用墨水机制的在线/离线状态
            /// 1bit:0   禁用墨水状态检测
            /// 1bit:1   启用墨水状态检测
            /// 2-7bit   保留
            /// <see cref="https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=123"/>
            /// </remarks>
            public static byte[] SelectAutoStatusBackForInk(int n) => new byte[] { 0x1D,0x6A,(byte)n};

            /// <summary>
            /// 传输状态
            /// </summary>
            /// <remarks>
            /// ASC GS  r   n
            /// HEX 1D  72  n
            /// 使用n传输状态，如下所示
            /// 1   传输纸张传感器状态
            /// 2   传输钱盒踢出连接器状态
            /// 4   传输墨水状态
            /// <see cref="https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=124"/>
            /// </remarks>
            public static byte[] TransmitStatus(int n) => new byte[] { 0x1D, 0x72, (byte)n };
        }

        /// <summary>
        /// 条形码命令
        /// </summary>
        public static class Barcode
        {
            /// <summary>
            /// 选择HRI字符的打印位置
            /// GS  H   n
            /// 1D  48  n
            /// </summary>
            public static byte[] SelectHRIPosition(HRIPosition hriPosition) => new byte[] { 0x1D, 0x21, (byte)hriPosition };

            //GS f
            //GS h

            /// <summary>
            /// 打印条形码
            /// GS  k    m  n
            /// 1D  6B  m   n
            /// </summary>
            /// <exception cref="ArgumentNullException">
            /// <paramref name="barCode"/> is <see langword="null"/>.</exception>
            public static byte[] PrintBarCode(BarCodeType barCodeType, string barCode, int heightInDots = 162)
            {
                var height = new byte[] { 0x1D, 0x68, (byte)heightInDots };
                var length = barCode.Length;
                var bar = Encoding.UTF8.GetBytes(barCode);
                if (barCodeType == BarCodeType.CODE128)
                {
                    length += 2;
                    bar = new byte[] { 0x7B, 0x42 }.Add(bar); //Subset CODE B is selected for CODE128 bars
                }
                var settings = new byte[] { 0x1D, 0x6B, (byte)barCodeType, (byte)length };

                return height.Add(settings, bar);
            }

            //GS w
        }

        /// <summary>
        /// 二维码命令
        /// </summary>
        public static class QRcode
        {
            /// <summary>
            /// 设置并打印符号
            /// GS  (   k   pL  pH  cn  fn  n1  n2
            /// 1D  28  6B  pL  pH  cn  fn  n1  n2
            /// </summary>
            /// <exception cref="ArgumentNullException"><paramref name="content"/> is <see langword="null"/>.</exception>
            public static byte[] PrintQRCode(string content, QRCodeModel qrCodemodel = QRCodeModel.Model1, QRCodeCorrection qrodeCorrection = QRCodeCorrection.Percent7, QRCodeSize qrCodeSize = QRCodeSize.Normal)
            {
                var model = new byte[] { 0x1D, 0x28, 0x6B, 0x04, 0x00, 0x31, 0x41, (byte)qrCodemodel, 0x00 };
                var size = new byte[] { 0x1D, 0x28, 0x6B, 0x03, 0x00, 0x31, 0x43, (byte)qrCodeSize };
                var errorCorrection = new byte[] { 0x1D, 0x28, 0x6B, 0x03, 0x00, 0x31, 0x45, (byte)qrodeCorrection };
                int num = content.Length + 3;
                int pL = num % 256;
                int pH = num / 256;
                var storeData = new byte[] { 0x1D, 0x28, 0x6B, (byte)pL, (byte)pH, 0x31, 0x50, 0x30 };
                var data = Encoding.UTF8.GetBytes(content);
                var print = new byte[] { 0x1D, 0x28, 0x6B, 0x03, 0x00, 0x31, 0x51, 0x30 };
                return model.Add(size, errorCorrection, storeData, data, print);
            }
        }

        /// <summary>
        /// 宏功能命令
        /// </summary>
        public static class Macro
        {
            /// <summary>
            /// 开始/结束宏定义
            /// </summary>
            /// <remarks>
            /// ASC GS  :
            /// HEX 1D  3A
            /// </remarks>
            public static byte[] StartEndMacroDefinition() => new byte[] { 0x1D, 0x3A };
            //GS ^
            /// <summary>
            /// 执行宏
            /// </summary>
            /// <remarks>
            /// ASC GS  ^   r   t   m
            /// HEX 1D  5E  r   t   m
            /// r指定执行次数
            /// t将间隔时间指定为(t×100毫秒)
            /// m指定执行模式
            /// 0 连续执行
            /// 1 通过按钮执行
            /// </remarks>
            public static byte[] ExecuteMacro => new byte[] { 0x1D, 0x5E };
        }

        /// <summary>
        /// 汉字命令
        /// </summary>
        public static class Chinese
        {
            /// <summary>
            /// 选择汉字字符的打印模式
            /// </summary>
            /// <remarks>
            /// ASCII   FS    !   n
            /// HEX     1C    21  n
            /// </remarks>
            public static byte[] SelectPrintModeForKanji() => throw new NotImplementedException();

            /// <summary>
            /// 选择汉字字符模式
            /// </summary>
            /// <remarks>
            /// ASCII   FS  &
            /// HEX     1C  26
            /// </remarks>
            public static byte[] SelectKanjiCharacterMode() => new byte[] { 0x1C, 0x26 };
            //FS -

            //FS.
            //FS 2
            //FS?
            //FS C
            //FS S
            //FS W

            //字体效果
            //FS(A
            //FS (A<fn=48>
        }

        /// <summary>
        /// 杂项命令
        /// </summary>
        public static class Miscellaneous
        {
            /// <summary>
            /// 发送实时请求到打印机
            /// </summary>
            /// <remarks>
            /// ASC DLE ENQ n
            /// HEX 10  05  n
            /// TM-U220:n = 2
            /// n=1:在联机恢复等待状态下，打印机的操作与按FEED按钮相同
            /// n=2:从可恢复的错误中恢复并从发生错误的行重新开始打印
            /// n=3:清除接收和打印缓冲区后，从可恢复的错误中恢复
            /// </remarks>
            public static byte[] SendRealtimeRequestToPrinter(int n)
            {
                return new byte[] { 0x10, 0x05, (byte)n };
            }

            /// <summary>
            /// 实时产生脉冲
            /// </summary>
            /// <remarks>
            /// 将t所指定的脉冲实时输出到连接器引脚m
            /// DLE DC4 <fn=1>
            /// ASC DLE DC4 fn  m   t
            /// HEX 10  14  01  m   t
            /// fn = 1;m = 0, 1;t = 1 – 8
            /// </remarks>
            public static byte[] GeneratePulseInRealtime(int m, int t)
            {
                return new byte[] { 0x10, 0x14, 0x01, (byte)m, (byte)t };
            }

            /// <summary>
            /// 执行关机顺序
            /// </summary>
            /// <remarks>
            /// 执行打印机电源关闭序列并发送电源关闭通知
            /// DLE DC4<fn=2>
            /// ASC DLE DC4 fn  a   b
            /// HEX 10  14  02  01  08
            /// 打印机执行电源关闭处理的设置后，打印机将如下所示的电源关闭通知发送到主机
            /// Header      0x3B    59  1byte
            /// Identifier  0x30    48  1byte
            /// NULL        0x00    0   1byte
            /// </remarks>
            /// <returns></returns>
            public static byte[] ExecutePoweroffSequence()
            {
                return new byte[] { 0x10, 0x14, 0x02, 0x01, 0x08 };
            }

            /// <summary>
            /// 实时蜂鸣器
            /// </summary>
            /// <remarks>
            /// 用由r指定的次数指定的声音模式使蜂鸣器发声
            /// DLE DC4 <fn=3>
            /// ASC DLE DC4 fn  a   n   r   t1  t2
            /// HEX 10  14  03  a   n   r   t1  t2
            /// 当a = 0时，停止鸣响蜂鸣器
            /// </remarks>
            /// <returns></returns>
            public static byte[] SoundBuzzerInRealtime()
            {
                throw new NotImplementedException();
            }

            /// <summary>
            /// 实时传输指定状态
            /// </summary>
            /// <remarks>
            /// DLE DC4<fn=7>
            /// ASC DLE DC4 fn  m
            /// HEX 10  14  07  m
            /// m=1:传输基本ASB状态
            /// m=2:传输扩展的ASB状态
            /// m=4:传送离线回应
            /// m=5:传输电池状态
            /// </remarks>
            /// <returns></returns>
            public static byte[] TransmitSpecifiedStatusInRealtime(int m)
            {
                return new byte[] { 0x10, 0x14, 0x07, (byte)m };
            }

            /// <summary>
            /// 清除缓冲区
            /// </summary>
            /// <remarks>
            /// 清除存储在接收缓冲区和打印缓冲区中的所有数据，并发送清除响应
            /// DLE DC4<fn=8>
            /// ASC DLE DC4 fn  d1  d2  d3  d4  d5  d6  d7
            /// HEX 10  14  08  01  03  14  01  06  02  08
            /// 缓冲区清除处理完成后，打印机将发送清除响应，如下所示
            /// Header      0x37    55  1byte
            /// Identifier  0x25    37  1byte
            /// NUL         0x00    0   1byte
            /// </remarks>
            /// <returns></returns>
            public static byte[] ClearBuffers()
            {
                return new byte[] { 0x10, 0x14, 0x08, 0x01, 0x03, 0x14, 0x01, 0x06, 0x02, 0x08 };
            }

            /// <summary>
            /// 指定批量打印
            /// </summary>
            /// <remarks>
            /// ASC ESC (   Y   pL  pH  m   n
            /// HEX 1B  28  59  pL  pH  m   n
            /// </remarks>
            /// <returns></returns>
            public static byte[] SpecifyBatchPrint()
            {
                throw new NotImplementedException();
            }

            /// <summary>
            /// 选择外围设备
            /// </summary>
            /// <param name="n">1 – 3</param>
            /// <remarks>
            /// ASC ESC =   n
            /// HEX 1B  3D  n
            /// TM-U220:n = 1 – 3;default=1
            /// 1, 3启用打印机;2禁用打印机
            /// </remarks>
            public static byte[] SelectPeripheralDevice(int n)
            {
                return new byte[] { 0x1B, 0x3D, (byte)n };
            }

            /// <summary>
            /// 初始化打印机
            /// </summary>
            /// <remarks>
            /// ASC ESC @
            /// Hex 1B  40
            /// Dec 27  64
            /// - 清除打印缓冲区中的数据,并将打印机模式重置为打开电源时有效的模式
            /// </remarks>
            public static byte[] InitializePrinter() => new byte[] { 0x1B, 0x40 };
            //ESC L
            /// <summary>
            /// 选择页面模式
            /// </summary>
            /// <remarks>
            /// 从标准模式切换到页面模式
            /// ASC ESC L
            /// HEX 1B  4C
            /// </remarks>
            public static byte[] SelectPageMode()
            {
                return new byte[] { 0x1B, 0x4C };
            }

            //ESC S
            /// <summary>
            /// 选择标准模式
            /// </summary>
            /// <remarks>
            /// 从页面模式切换到标准模式
            /// ASC ESC S
            /// HEX 1B  53
            /// </remarks>
            public static byte[] SelectStandardMode()
            {
                return new byte[] { 0x1B, 0x53 };
            }

            /// <summary>
            /// 产生脉冲(未理解)
            /// </summary>
            /// <remarks>
            /// 将t1和t2指定的脉冲输出到指定的连接器引脚m
            /// ASCII   ESC p   m   t1  t2
            /// Hex     1B  70  m   t1  t2
            /// m = 0, 1, 48, 49
            /// t1 = 0 – 255
            /// t2 = 0 – 255
            /// </remarks>
            public static byte[] GeneratePulse() => throw new NotImplementedException();

            //GS ( A
            /// <summary>
            /// 执行测试打印
            /// </summary>
            /// <remarks>
            /// 执行指定的测试打印
            /// ASC GS  (   A   pL  pH  n   m
            /// HEX 1D  28  41  02  00  n   m
            /// n:指定用于测试打印的纸张，如下所示
            /// 0:基本纸（卷纸）;1,2:卷纸
            /// m:指定一个测试模式，如下所示
            /// 1:十六进制转储
            /// 2:打印机状态打印
            /// 3:滚动模式
            /// 64:自动设置纸张布局
            /// </remarks>
            public static byte[] ExecuteTestPrint(int n,int m)
            {
                return new byte[] { 0x1D, 0x28, 0x41, 0x02, 0x00, (byte)n, (byte)m };
            }

            /// <summary>
            /// 启用/禁用实时命令
            /// </summary>
            /// <remarks>
            /// ASC GS  (   D   pL  pH  m   [a1 b1] ... [ak bk]
            /// HEX 1D  28  44  pL  pH  14  [a1 b1] ... [ak bk]
            /// (pL + pH × 256) = 3, 5
            /// m = 20
            /// b = 0, 1, 48, 49
            /// a = 1,2
            /// </remarks>
            /// <returns></returns>
            public static byte[] SelectRealtimeCommand()
            {
                throw new NotImplementedException();
            }

            /// <summary>
            /// 传送打印机ID
            /// </summary>
            /// <param name="n">打印机ID类型</param>
            /// <remarks>
            /// 传输打印机ID或打印机信息
            /// ASC GS  I   n
            /// HEX 1D  49  n
            /// <see cref="https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=198"/>
            /// </remarks>
            /// <returns></returns>
            public static byte[] TransmitPrinterID(int n)
            {
                return new byte[] { 0x1D, 0x49, (byte)n };
            }

            //GS P
            //GS g 0
            //GS g 2
            //GS z 0

            //GS(H
            //GS (H<fn=48>
            //GS (H<fn=49>
            //GS (K
            //GS (K<fn=48>
            //GS (K<fn=49>
            //GS (K<fn=50>
            //GS (K<fn=97>
            //ESC (A
            //ESC (A<fn=48>
            //ESC (A<fn=97>
            //ESC (A<fn=98>
            //ESC (A<fn=99>
            //GS (Q
            //GS (Q<fn=48>
            //GS (Q<fn=49>
            //FS (E
            //FS (E<fn=60>
            //FS (E<fn=61>
            //FS (E<fn=62>
            //FS (E<fn=63>
            //FS (E<fn=64>
            //FS (E<fn=65>
            //GS (P
            //GS (P<fn=48>
        }

        /// <summary>
        /// 自定义命令
        /// </summary>
        [Obsolete("未添加")]
        public static class Customize
        {
            //用户设定
            //GS (E
            //GS (E<fn=1>

            /// <summary>
            /// 结束用户设置模式会话
            /// </summary>
            /// <remarks>
            /// 结束用户设置模式，并执行软件重置 
            /// GS ( E <fn=2>
            /// ASC GS  (   E   pL  pH  fn  d1  d2  d3
            /// HEX 1D  28  45  04  00  02  4F  55  54
            /// (pL + pH × 256) = 4
            /// fn = 2
            /// d1 = 79 (Character "O")
            /// d2 = 85 (Character "U")
            /// d3 = 84 (Character "T")
            /// </remarks>
            /// <returns></returns>
            public static byte[] EndTheUserSettingModeSession()
            {
                return new byte[] { 0x1D, 0x28, 0x45, 0x04, 0x00, 0x02, 0x4F, 0x55, 0x54 };
            }

            //GS (E<fn=3>
            //GS (E<fn=4>
            //GS (E<fn=5>
            //GS (E<fn=6>
            //GS (E<fn=7>
            //GS (E<fn=8>
            //GS (E<fn=9>
            //GS (E<fn=10>
            //GS (E<fn=11>
            //GS (E<fn=12>
            //GS (E<fn=13>
            //GS (E<fn=14>
            //GS (E<fn=15>
            //GS (E<fn=16>
            //GS (E<fn=48>
            //GS (E<fn=49>
            //GS (E<fn=50>
            //GS (E<fn=51>
            //GS (E<fn=52>
            //GS (E<fn=99>
            //GS (E<fn=100>

            //打印机定制
            //GS (M
            //GS (M<fn=1>
            //GS (M<fn=2>
            //GS (M<fn=3>

            //NV用户内存
            //FS g 1
            //FS g 2
            //编辑NV用户内存
            //GS (C
            //GS (C<fn=0>
            //GS (C<fn=1>
            //GS (C<fn=2>
            //GS (C<fn=3>
            //GS (C<fn=4>
            //GS (C<fn=5>
            //GS (C<fn=6>
        }

        /// <summary>
        /// 计数器命令
        /// </summary>
        [Obsolete("某些打印机型号支持此命令，以后的型号则不支持。 ESC / POS没有替代命令")]
        public static class Counter
        {
            /// <summary>
            /// 选择计数器打印模式
            /// </summary>
            /// <remarks>
            /// 选择序列号计数器值的打印格式（打印位数和整个打印位数范围内的打印位置）
            /// ASC GS  C   0   n   m
            /// HEX 1D  43  30  n   m
            /// n = 0 – 5
            /// m = 0 – 2, 48 – 50
            /// </remarks>
            [Obsolete("某些打印机型号支持此命令，以后的型号则不支持。 ESC / POS没有替代命令")]
            public static byte[] SelectCounterPrintMode(int n, int m) => new byte[] { 0x1D, 0x43, 0x30, (byte)n, (byte)m };

            /// <summary>
            /// 选择计数模式(A)
            /// </summary>
            /// <remarks>
            /// 设置序列号计数器范围，步进量和重复编号
            /// ASC GS  C   1   aL  aH  bL  bH  n   r
            /// HEX 1D  43  31  al  aH  bL  bH  n   r
            /// </remarks>
            [Obsolete("某些打印机型号支持此命令，以后的型号则不支持。 ESC / POS没有替代命令")]
            public static byte[] SelectCountModeA() => throw new NotImplementedException();

            /// <summary>
            /// 设置计数器
            /// </summary>
            /// <remarks>
            /// 将计数器值设置为（nL + nH×256）
            /// ASC GS  C   2   nL  nH
            /// HEX 1D  43  32  nL  nH
            /// </remarks>
            /// <returns></returns>
            [Obsolete("某些打印机型号支持此命令，以后的型号则不支持。 ESC / POS没有替代命令")]
            public static byte[] SetCounter() => throw new NotImplementedException();

            /// <summary>
            /// 选择计数模式(B)
            /// </summary>
            /// <remarks>
            /// 通过使用字符串设置序列号计数器范围，序列号计数器值，步进量和重复数
            /// ASC GS  C   ;   sa  ;   sb  ;   sn  ;   sr  ;   sc  ;
            /// HEX 1D  43  3B  sa  3B  sb  3B  sn  3B  sr  3B  sc  3B
            /// </remarks>
            /// <returns></returns>
            [Obsolete("某些打印机型号支持此命令，以后的型号则不支持。 ESC / POS没有替代命令")]
            public static byte[] SelectCountModeB()=>throw new NotImplementedException();

            /// <summary>
            /// 打印计数器
            /// </summary>
            /// <remarks>
            /// 将序列号计数器值存储在打印缓冲区中，并递增或递减序列号计数器值
            /// ASC GS  c
            /// HEX 1D  63
            /// </remarks>
            /// <returns></returns>
            [Obsolete("某些打印机型号支持此命令，以后的型号则不支持。 ESC / POS没有替代命令")]
            public static byte[] PrintCounter() => throw new NotImplementedException();

        }
    }
}
